﻿using System.ComponentModel;
using System.Drawing;
using RaytracerLib;
using RaytracerLib.MathLib;
using RaytracerLib.Lights;

namespace Raytracer.PropertyGridDecorators
{
    public class OmniLightProperties : SceneActorProperties
    {
        private OmniLight m_light;

        public OmniLightProperties(OmniLight a_light) :
            base(a_light)
        {
            m_light = a_light;
        }

        [DisplayName("System color")]
        [Category(Categories.PROPERTIES)]
        public Color SystemColor
        {
            get
            {
                return m_light.Color.SystemColor;
            }
            set
            {
                m_light.Color = new ColorFloat(value);
            }
        }

        [Category(Categories.PROPERTIES)]
        [TypeConverter(typeof(ColorFloatConverter))]
        public ColorFloatProperties Color
        {
            get
            {
                return new ColorFloatProperties(
                    () => m_light.Color,
                    (c) => m_light.Color = c);
            }
            set
            {
                m_light.Color = value.ToColorFloat();
            }
        }

        [Category(Categories.PROPERTIES)]
        public bool On
        {
            get
            {
                return m_light.On;
            }
            set
            {
                m_light.On = value;
            }
        }
    }
}